<script setup lang="ts">
import { ref, onMounted, } from 'vue'
import Editor from '@hufe921/canvas-editor'

const canvasEditor = ref<any>(null)


onMounted(() => {
    let qs = document.querySelector('.canvas-editor')
    canvasEditor.value = new Editor(
        qs,
        [
            {
                value: 'Hello World'
            }
        ],
        {table:true}
    ) 
});

function inset() {
    console.log(canvasEditor.value);
    // debugger
    canvasEditor.value.command.executeInsertTable(10, 10);
    console.log(canvasEditor.value);
    canvasEditor.value.command.executeImage({
        width: 100,
        height: 100,
        value: 'https://www.hao5920.com/zb_users/upload/editor/20221216/639b657d5df03.jpg'
    })
  
}

</script>
<template>
    <button @click="inset">插入</button>
    <div class="canvas-editor"></div>
</template>
<style></style>
